#ifndef GOTOFUNCTIONDLG_H
#define GOTOFUNCTIONDLG_H

#include "incremental_select_helper.h"

class GotoFunctionDlg : public wxDialog {
  public:
    struct FunctionToken {
      wxString displayName, name;
      wxString paramsAndreturnType, funcName;
      unsigned line, implLine;
    };

    struct Iterator : IncrementalSelectIteratorIndexed {
        Iterator();

        void AddToken( const FunctionToken &token );
        const FunctionToken* GetToken( int index ) const;

        int GetTotalCount() const override;
        const wxString& GetItemFilterString( int index ) const override;
        wxString GetDisplayText( int index, int column ) const override;

        void SetColumnMode( bool flag );

        int GetColumnWidth( int column ) const override;
        void CalcColumnWidth( wxListCtrl &list ) override;

        void Sort();

      private:
        std::vector<FunctionToken> m_tokens;
        int m_columnLength[3];
        bool m_columnMode;
    };
  public:

    GotoFunctionDlg( wxWindow* parent, Iterator* iterator );
    virtual ~GotoFunctionDlg();

    int GetSelection();

  private:

    IncrementalListCtrl* m_list;
    wxCheckBox* m_mode;
    wxTextCtrl* m_text;
    static const long ID_CHECKBOX1;
    static const long ID_TEXTCTRL1;
    static const long ID_LISTCTRL1;
    void OnModeClick( wxCommandEvent& event );
  private:
    void BuildContent( wxWindow* parent, Iterator* iterator );
    void SwitchMode();
  private:
    IncrementalSelectHandler m_handler;
    Iterator *m_iterator;
  private:
    DECLARE_EVENT_TABLE()
};

#endif
